import {
  mapGetters
} from "vuex"

export default {
  computed: {
    ...mapGetters('m_cart', ['total'])
  },
  watch: {
    total() {
      this.getTarbar()
    }
  },
  onShow() {
    this.getTarbar()
  },
  methods: {
    getTarbar() {
      uni.setTabBarBadge({
        index: 1, //tabbar的索引号
        text: this.total + '' //设置的数字图标，主义不能是数字类型，要是字符串
      })
    }
  }
}
